package com.yly.doctorapp.startpager;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

import com.yly.doctorapp.R;
import com.yly.doctorapp.base.BaseActivity;
import com.yly.doctorapp.constant.Configution;
import com.yly.doctorapp.ui.home.HomePagerActivity;
import com.yly.doctorapp.ui.usercenter.LoginActivity;
import com.zhcx.zhcxlibrary.utils.SPUtils;
import com.zhcx.zhcxlibrary.utils.StringUtils;

public class StartPagerActivity extends BaseActivity {
    private SPUtils mSputils;

    @Override
    protected int getNaviteColor() {
        return 0;
    }

    @Override
    protected int getContentLayoutId() {
        return R.layout.activity_startpager;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        mSputils = new SPUtils(getApplicationContext());
        mHandler.sendEmptyMessageDelayed(0, 1000);
    }

    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case 0:
                    lodIn();
                    break;
            }
        }
    };

    private void lodIn() {
        if (!StringUtils.isEmpty(mSputils.getString(Configution.USERPHONE)) && !StringUtils.isEmpty(mSputils.getString(Configution.USERPASSWORD))) {
            Intent mIntent = new Intent(StartPagerActivity.this, HomePagerActivity.class);
            mIntent.putExtra("type", "0");
            startActivity(mIntent);
            finish();
        } else {
            Intent mIntent = new Intent(StartPagerActivity.this, LoginActivity.class);
            startActivity(mIntent);
            finish();
        }
    }

    @Override
    protected void initData() {

    }
}
